<template>
<div>
    <Phead />
    <div class="langgreen">
        <div class="langgreen">
            <h6 class="haswonthebid"><i></i>&nbsp;&nbsp; 报价已结束 &nbsp;&nbsp;<i></i></h6>
        </div>
    </div>
    <div class="w inthebidding stamp">
        <div class="clearfix">
            <div class="box-1 box">
                <h4>项目信息</h4>
                <table>
                    <tbody>
                        <tr>
                            <td>项目名称：{{bid_data.bid_name}}</td>
                            <td>项目编号：{{bid_data.bid_sn}}</td>
                        </tr>
                        <tr>
                            <td>收货地址：{{bid_data.area}}</td>
                            <td>收货时间：{{bid_data.bid_arrival_time}}</td>
                        </tr>
                        <tr>
                            <td>预算：{{bid_data.bid_budget}}</td>
                            <td>最低降幅：千分之四</td>
                        </tr>
                    </tbody>
                </table>
            </div>
            <div class="box-2 box" v-if="bid_data.bid_status != 30">
                <h5 class="succeed">项目成交价</h5>
                <span>{{bid_data.pick_price}}<div class="small"> 元</div></span>
                <!-- 中标提示 -->
                <em v-if="bid_data.is_show_tips">
                    {{bid_data.tips_content}} <br>客服电话：18515116868
                </em>
                <img src="@/assets/img/succeed.png" alt="">
            </div>
            <div class="box-2 box" v-else>
                <h5 class="succeed">本次竞价结果为</h5>
                <span style="color:#10bd1d">报价人数不足</span>

            </div>
        </div>
        <div class="box box-4">
            <i>备注信息</i>
            <p>
                {{bid_data.bid_remark}}
            </p>
        </div>
        <div class="box box-3" v-if="bid_data.bid_status != 30">
            <h4>中标信息</h4>
            <table>
                <tbody>
                    <tr>
                        <td>供应商：{{bid_data.pick_user_company}}</td>
                        <td>报价金额：￥{{bid_data.pick_price}}</td>
                    </tr>
                    <tr>
                        <td>电话：{{bid_data.prick_phone}}</td>
                        <td>咨询及投诉电话：{{bid_data.supervise_phone}}</td>
                    </tr>
                </tbody>
            </table>
        </div>
        <div class="box box-5">
            <h4>招标产品</h4>
            <table>
                <tbody>
                    <tr v-for="(item,index) in bid_data.goods">

                      <td>{{item.goods_name}}</td>
                      <td>{{item.goods_num}}</td>
                      <td>{{item.goods_price}}元</td>
                      <td @click="showGoods(index)" >
                        <button>产品详情</button>
                      </td> 
                    </tr>
                    
                </tbody>
            </table>
        </div>
        <div class="box box-8">
            <h4>投标明细</h4>
            <table class="clearfix">
                <tbody>
                    <tr v-for="(item,index) in bid_data.record" :key="index">
                        <td>
                            <div class="date">
                                <div class="left fl">
                                    <p>{{item.add_time}}</p>
                                </div>
                                <div class="right fr">
                                    <!-- <p>18:39</p> -->
                                    <p>第{{item.rotation}}轮</p>
                                </div>
                                <i></i>
                            </div>
                        </td>
                        <td>供应商：{{item.user_company}}</td>
                        <td>投注金额：{{item.price}}元</td>
                    </tr>
                    
                </tbody>
            </table>
<!--             <button>全部明细</button>
 -->        </div>
           <div class="box box-6"></div>

    </div>


<Pfoot />

    
    

    <!-- 产品详情弹窗 -->
    <div class="dialog">
        <div class="black"  v-if="isProMaskShow">
            <div class="dialog-cover back"  @click="isProMaskShow =false"></div>
            <div class="hint3">
                <h2>{{goods_detail.goods_name}}</h2>
                <p>品牌/型号：{{goods_detail.goods_brand_model}}</p>
                <p>单位：{{goods_detail.goods_unit}}</p>
                <p>数量：{{goods_detail.goods_num}}</p>
                <p>单价：￥{{goods_detail.goods_price}}</p>
                <p>产品说明：{{goods_detail.goods_remark}}</p>
                <div class="close" @click="isProMaskShow = false">关闭</div>
            </div>
        </div>
    </div>

</div>
</template>

<script>
import Phead from '@/components/Phead.vue'
import Pfoot from '@/components/Pfoot.vue'
import Pdailog from '@/components/Pdailog.vue'

export default {
  data(){
    return{
        headBg: false,  //左上角 “< 投标” 使用数据  当页面向下滚动  该值变为 true
        bid_data:{},
        bjVal:0.00,
        formatMoney:0.00,

        h: '00', //时
        m: '00', //分
        s: '00', //秒
        guize: '本次报价共3轮，每轮允许报价1次，每轮报价10分钟',
        goods_detail:{
          goods_name:'',
          goods_brand_model:'',//品牌型号
          goods_unit:'',
          goods_price:'',
          goods_num:'',
          goods_remark:''
        },
        isProMaskShow:false,
        downTime:'',
          
     }
  },
  async created(){
    let user_token = this.getUserToken()
    let bidid =  this.$route.query.bid_id
    let re = await this.$axios.post('bid/getBidDetail',{
        bid_id:bidid,
        user_token:user_token
    })
    if(re.code == 200){
        let toWhere = '/bid/'+re.data.toWhere;
        //如果不是当前页面跳转
        if(toWhere != this.$route.path){
            this.$router.push({path:'/'+toWhere+'?bid_id='+bidid})
            
        }else{
              let bid_data = re.data;
              this.bid_data = bid_data
              
        }    


     }

  },
  
  components: {
    Phead,
    Pfoot,
    Pdailog
  },


  mounted(){
            
  },
  
  methods:{
    //显示商品
     showGoods(index){
      let goods = this.bid_data.goods[index];
      console.log(index)
      this.isProMaskShow = true
      this.goods_detail.goods_name = goods.goods_name
      this.goods_detail.goods_brand_model = goods.goods_brand_model

      this.goods_detail.goods_unit = goods.goods_unit
      this.goods_detail.goods_num = goods.goods_num
      this.goods_detail.goods_price = goods.goods_price
      this.goods_detail.goods_remark = goods.goods_remark
    },
    reback(){
        if(this.$route.query.redirect){
              if(this.$route.query.bidtype){
                this.$router.replace({path:this.$route.query.redirect,query:{
                  bidtype:this.$route.query.bidtype
                }});
              }else{
                this.$router.replace({path:this.$route.query.redirect})
              }
        }else{
             this.$router.replace({path:'/'})
        }
     }

    

  },

}
</script>